Skip to main content

Fauna

Summary

This document covers the information to gather from FaunaDB in order to configure a Qarbine data service. The data service will use the Qarbine Fauna driver. You can define multiple data services that access the different Fauna endpoints by using different credentials. Once a data service is defined, you can manage which Qarbine principals have access to it and its associated Fauna data. A Qarbine administrator has visibility to all data services.

Overview

Fauna is a distributed document-relational database designed for modern application development. It combines the flexibility of JSON-like documents with the consistency and query capabilities of relational databases. The Fauna Query Language (FQL) supports complex joins and data transformations, making it a powerful tool for developers. Separate documents provide details on using FQL and authoring queries in Qarbine.

Fauna Configuration

Overview

Qarbine requires a Fauna key to access the Fauna cloud service. Log in to the Fauna cloud console at

https://fauna.com/

You can use an existing key or create a new one. It is highly recommended that the key have “server (read-only)” access. The key value is used as the ‘secret’ parameter for the Fauna client to access the Fauna database service.

Creating a Key

In the Fauna console page select the database of interest.

Navigate to the Keys area of that database.

  

Click

  

Choose the Role. It is highly recommended that the key have “server (read-only)” access.
Fill in the name as desired.

  

Click

  

For the next dialog shown

  

click

  

Paste the value into a temporary area as it will be used in the next step described below.

Qarbine Configuration

Compute Node Preparation

Determine which compute node service endpoint you want to run this data access from. That URL will go into the Data Service’s Compute URL field. Its form is “https://domain:port/dispatch”. A sample is shown below.

  

The port number corresponds to a named service endpoint configured on the given target host. For example, the primary compute node usually is set to have a ‘main’ service. That service’s configuration is defined in the ˜./qarbine.service/config/service.main.json file. Inside that file the following driver entry is required

"drivers" :[
. . .
"./driver/faunaDriver.js"
]

The relevant configuration file name for non primary (main) Qarbine compute nodes is service.NAME.json. Remember to have well formed JSON syntax or a startup error is likely to occur. If you end up adding that entry then restart the service via the general command line syntax

pm2 restart <service>

For example,

pm2 restart main

or simply

pm2 restart all

Data Service Definition

Open the Administration Tool.

Navigate to the Data Services tab.

  

A data service defines on what compute node a query will run by default along with the means to reach to target data. The latter includes which native driver to use along with settings corresponding to that driver. Multiple Data Sources can reference a single Data Service. The details of any one Data Service are thus maintained in one spot and not spread out all over the place in each Data Source. The latter is a maintenance and support nightmare.

To begin adding a data service click

  

On the right hand side enter a data service name and description. The name can be functional or technical in nature.

  

Also choose the “Fauna” driver.

  

Specify the endpoint for the server template.

  

Specify the server options. The secret value is the key value from Fauna. Fauna has a variety of other connection options which can be specified using a CSV list of key\value pairs.

  

You can reference environment variables using the syntax %NAME%. Any strings should be quoted and the key\value pairs separated by commas.

Next, test the settings by clicking on the icon noted below.

  

The result should be

  

Save the Data Service by clicking on the image highlighted below.

  

The data service will be known at the next log on time. Next, see the Fauna oriented query interaction and any tutorial for information on interacting with Fauna from Qarbine.